#include "gamegatebus.h"

CGameGateBus::CGameGateBus()
{

}
CGameGateBus::~CGameGateBus()
{

}
bool CGameGateBus::OpenBus()
{
	if(!m_game2gate.Open("game2gate"))
	{
		printf("open game2gate bus fail");
		return false;
	}
	if(!m_gate2game.Open("gate2game"))
	{
		printf("open gate2game bus fail");
		return false;
	}
	return true;
}
bool CGameGateBus::SendToGate(const char* buf, unsigned int len)
{
	return m_game2gate.Send(buf, len);
}
bool CGameGateBus::RecvFromGate(char* buf, unsigned int buf_len, unsigned &len)
{
	return m_gate2game.TryRecv(buf, buf_len, len);
}

bool CGameGateBus::SendToGame(const char* buf, unsigned int len)
{
	return m_gate2game.Send(buf, len);
}
bool CGameGateBus::RecvFromGame(char* buf, unsigned int buf_len, unsigned &len)
{
	return m_game2gate.TryRecv(buf, buf_len, len);
}